#include <iostream>
#include <functional>

using namespace std;

class Example {
public:
    int add(int x, int y) {
        cout << "int Example::add(int, int)" << endl;
        return x + y;
    }

    int data = 100;//C++11中初始化数据成员的新方式
};


void test() {
    Example ex;
    function<int()> f = bind(&Example::add, &ex, 1, 2);
    cout << "f() = " << f() << endl;
}


int main() {
    test();
    return 0;
}
